
<div class="grid_10">
	<div class="box round first fullpage">
		<h2>Galer&iacute;a de im&aacute;genes</h2>
		<div class="block ">
			<div class="imagenesDiv">
				<br><br>
				<form action="imagenes.php" id="formImage" name="formImage" enctype="multipart/form-data" method="POST">
					<input type="hidden" id="sendform" name="sendform" value="true"/>
					<input type="hidden" id="iditem" name="iditem" value="{$iditem}"/>
					<input type="hidden" id="id" name="id" value=""/>
					<input type="hidden" id="action" name="action" value="add"/>
					<input type="hidden" id="t" name="t" value="{$t}"/>
					<table class="item" cellpadding="5" style="background-color: #BEDBDD;border: 1px solid #7FA2A5;padding: 10px;">
						<tr>
							<td class="title">
								Archivo de la im&aacute;gen:
							</td>
							<td class="input">
								<input type="file" name="imgfile" id="imgfile"><br/>
							</td>
						</tr>
						<tr>
							<td colspan="2" class="botton">
								<input type="submit" id="imgSubmitBtn" class="confirm" value="Agregar im&aacute;gen"/>	
							</td>	
						</tr>
					</table>
					<br/>
				</form>
			
				{foreach from=$images item=image}
					<form id="formImageItem" method="POST" action="imagenes.php">
						<input type="hidden" id="iditem" name="iditem" value="{$iditem}"/>
						<input type="hidden" id="t" name="t" value="{$t}"/>
						<input type="hidden" id="action{$image.id}" name="action" value="update"/>
						<input type="hidden" id="defaultimage-{$image.id}" name="defaultimage" value="0"/>
						<input type="hidden" id="id" name="id" value="{$image.id}"/>	
						<div class="imageDiv">
							<div style="text-align:center; height:100px;"><img width="150px" height="120px" style="border: 2px solid silver" src="images/{$t}/small/{$image.filename}"/></div>
							<div class="right">
								
								<br/><br/>&nbsp; 
								{if $entidad.imagesid != $image.id}
									<button style="float:right" onclick="javascript:selectDefaultImage('{$image.id}')"/>Principal</button>
								{else}
									<b>(Es la principal)</b>
								{/if}
								<button style="float:left" onclick="javascript:deleteImage('{$image.id}','formImageItem')">Eliminar</button>
								<div style="clear:both"></div>
							</div>
						</div>
					</form>
				{/foreach}
				<div style="clear:both" ></div>
			</div>
		</div>
	</div>
</div>

	
